package tp.pr4.listeners;

import java.util.ArrayList;

import tp.pr4.Direction;
import tp.pr4.Place;
import tp.pr4.instructions.Instruction;
import tp.pr4.items.Item;
import tp.pr4.items.ItemContainer;

public class RobotListenerArray extends ArrayList<RobotListener> implements RobotListener {
	private static final long serialVersionUID = 1L;

	@Override
	public void onFuelChanged(int newFuel) {
		for (int i = 0; i < this.size(); i++)
			this.get(i).onFuelChanged(newFuel);
	}

	@Override
	public void onPointsChanged(int newPoints) {
		for (int i = 0; i < this.size(); i++)
			this.get(i).onPointsChanged(newPoints);
	}

	@Override
	public void onInventoryChanged(ItemContainer inventory, Place where) {
		for (int i = 0; i < this.size(); i++)
			this.get(i).onInventoryChanged(inventory, where);
	}

	@Override
	public void onItemUsed(Item usedItem, Direction direction) {
		for (int i = 0; i < this.size(); i++)
			this.get(i).onItemUsed(usedItem, direction);
	}

	@Override
	public void onInstructionFailed(Instruction c) {
		for (int i = 0; i < this.size(); i++)
			this.get(i).onInstructionFailed(c);
	}

	@Override
	public void onDeath() {
		for (int i = 0; i < this.size(); i++)
			this.get(i).onDeath();
	}
}
